/**
 * @author Caius
 * @description
 *        实现数据的操作返回实现类service操作
 * @version 1.0
 * @since Created in 2024-12-09
 */

package com.itsense.lib_sys.service.Impl;

import com.itsense.lib_sys.dao.BookDao;
import com.itsense.lib_sys.model.Book;
import com.itsense.lib_sys.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;

    @Override
    public boolean save(Book book) {
        int row = bookDao.save(book);
        return row > 0;
    }

    @Override
    public boolean deleteById(Integer id) {
        int row = bookDao.deleteById(id);
        return row > 0;
    }

    @Override
    public boolean update(Book book) {
        int row = bookDao.update(book);
        return row > 0;
    }

    @Override
    public Book getById(Integer id) {
        return bookDao.getById(id);
    }

    @Override
    public List<Book> getAll() {
        return bookDao.getAllBook();
    }
}
